package imaa.escola.turma.domain;

import imaa.escola.disciplina.domain.Disciplina;
import imaa.escola.professor.domain.Professor;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ESCOLA.TURMA")
public class Turma {

	private Long id;
	private String descricao;
	private Integer maximoAlunos;
	private Date dataHora;
	private Disciplina disciplina;
	private Professor professor;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "SEQ_TURMA")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "DSC_TURMA")
	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String desc) {
		this.descricao = desc;
	}

	@Column(name = "MAX_ALUNOS")
	public Integer getMaximoAlunos() {
		return maximoAlunos;
	}

	public void setMaximoAlunos(Integer numMaxAlunos) {
		this.maximoAlunos = numMaxAlunos;
	}

	@Column(name = "DATA_HORA")
	public Date getDataHora() {
		return dataHora;
	}

	public void setDataHora(Date dataHora) {
		this.dataHora = dataHora;
	}

	@ManyToOne(cascade = CascadeType.ALL, targetEntity = Disciplina.class)
	@JoinColumn(name = "SEQ_DISCIPLINA")
	public Disciplina getDisciplina() {
		return disciplina;
	}

	public void setDisciplina(Disciplina disciplina) {
		this.disciplina = disciplina;
	}
	
	@ManyToOne(cascade = CascadeType.ALL, targetEntity = Professor.class)
	@JoinColumn(name = "SEQ_PESSOA_PROFESSOR")
	public Professor getProfessor() {
		return professor;
	}

	public void setProfessor(Professor professor) {
		this.professor = professor;
	}

}
